package cn.edu.scau.cmi.wujiaxian.exercise9;

import static java.util.Calendar.*;
import java.util.Calendar;
import java.util.Date;

public class Example9_15 {
	

	public static void main(String[] args) {
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(new Date());
		String year = String.valueOf(calendar.get(YEAR));
		String month = String.valueOf(calendar.get(MONTH) + 1);
		String day = String.valueOf(calendar.get(DAY_OF_MONTH));
		int hour = calendar.get(HOUR_OF_DAY);
		int minute = calendar.get(MINUTE);
		int second = calendar.get(SECOND);
		System.out.println(year + ":" + month + ":" + day + " " 
				+ hour + ":" + minute + ":" + second);
		calendar.set(1949, 9 - 1, 1);
		long time1 = calendar.getTimeInMillis();
		calendar.set(2009, 9 - 1, 1);
		long time2 = calendar.getTimeInMillis();
		long days = (time2 - time1) / (1000 * 60 * 60 * 24);
		System.out.println(days);
	}
	
}
